home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / E-G / educationstacks.sea / Circuits / card_6536.txt < prev    next >
Text File  |  1989-02-26  |  8KB  |  398 lines

  1. -- card: 6536 from stack: in
  2. -- bmap block id: 6903
  3. -- flags: 0000
  4. -- background id: 2693
  5. -- name: 
  6. ----- HyperTalk script -----
  7. on calculate
  8.  
  9.   -- Since the Wheatstone Bridge is an example of the previous card's
  10.   -- resistor network, I use the same names for the resistors.  This
  11.   -- means that the user's Rx is R3 in this script, while the user's
  12.   -- R3 is R4 here.
  13.  
  14.   get char 1 of card field "R1"
  15.   if it="+" then
  16.     delete char 1 of card field "R1"
  17.   end if
  18.   put card field "R1" into R1
  19.   put abs(R1) into R1
  20.   put R1 into card field "R1"
  21.  
  22.   get char 1 of card field "R2"
  23.   if it="+" then
  24.     delete char 1 of card field "R2"
  25.   end if
  26.   put card field "R2" into R2
  27.   put abs(R2) into R2
  28.   put R2 into card field "R2"
  29.  
  30.   get char 1 of card field "R3"
  31.   if it="+" then
  32.     delete char 1 of card field "R3"
  33.   end if
  34.   put card field "R3" into R3
  35.   put abs(R3) into R3
  36.   put R3 into card field "R3"
  37.  
  38.   get char 1 of card field "R4"
  39.   if it="+" then
  40.     delete char 1 of card field "R4"
  41.   end if
  42.   put card field "R4" into R4
  43.   put abs(R4) into R4
  44.   put R4 into card field "R4"
  45.  
  46.   get char 1 of card field "R5"
  47.   if it="+" then
  48.     delete char 1 of card field "R5"
  49.   end if
  50.   put card field "R5" into R5
  51.   put abs(R5) into R5
  52.   put R5 into card field "R5"
  53.  
  54.   get char 1 of card field "RV"
  55.   if it="+" then
  56.     delete char 1 of card field "RV"
  57.   end if
  58.   put card field "RV" into RV
  59.   put abs(RV) into RV
  60.   put RV into card field "RV"
  61.  
  62.   get char 1 of card field "EMF"
  63.   if it="+" then
  64.     delete char 1 of card field "EMF"
  65.   end if
  66.   put card field "EMF" into EMF
  67.   put EMF into card field "EMF"
  68.  
  69.   if R1=0 and R2=0 and R3=0 and R4=0 then
  70.  
  71.     put 0 into RE
  72.  
  73.   else
  74.  
  75.     if R5=0 and R1=0 and R2=0 then
  76.       put R3*R4/(R3+R4) into RE
  77.  
  78.     else
  79.  
  80.       if R5=0 and R3=0 and R4=0 then
  81.         put R1*R2/(R1+R2) into RE
  82.  
  83.       else
  84.  
  85.         put (R2*R3*(R1+R4)+R1*R4*(R2+R3)+R5*(R1+R3)*(R2+R4))/ ((R1+R2)*(R3+R4)+R5*(R1+R2+R3+R4)) into RE
  86.  
  87.       end if
  88.     end if
  89.   end if
  90.  
  91.   put RE + RV into R
  92.  
  93.   if R=0 then
  94.     put "zap" into card field "I"
  95.     exit calculate
  96.   end if
  97.  
  98.   set numberFormat to "0"
  99.  
  100.   put (1000000*EMF/R)*(R2*R3-R1*R4)/((R1+R2)*(R3+R4)+R5*(R1+R2+R3+R4)) into card field "I5"
  101.  
  102.   set numberFormat to "0.0"
  103.  
  104.   put 1000*EMF/R into card field "I"
  105.  
  106. end calculate
  107.  
  108. on closeField
  109.  
  110.  
  111. end closeField
  112.  
  113.  
  114.  
  115. -- part 1 (button)
  116. -- low flags: 00
  117. -- high flags: 0001
  118. -- rect: left=258 top=299 right=332 bottom=300
  119. -- title width / last selected line: 0
  120. -- icon id / first selected line: 0 / 0
  121. -- text alignment: 1
  122. -- font id: 0
  123. -- text size: 12
  124. -- style flags: 0
  125. -- line height: 16
  126. -- part name: 
  127.  
  128.  
  129. -- part 2 (button)
  130. -- low flags: 00
  131. -- high flags: 0001
  132. -- rect: left=308 top=299 right=332 bottom=350
  133. -- title width / last selected line: 0
  134. -- icon id / first selected line: 0 / 0
  135. -- text alignment: 1
  136. -- font id: 0
  137. -- text size: 12
  138. -- style flags: 0
  139. -- line height: 16
  140. -- part name: 
  141.  
  142.  
  143. -- part 3 (field)
  144. -- low flags: 00
  145. -- high flags: 0000
  146. -- rect: left=43 top=74 right=86 bottom=86
  147. -- title width / last selected line: 0
  148. -- icon id / first selected line: 0 / 0
  149. -- text alignment: 65535
  150. -- font id: 3
  151. -- text size: 9
  152. -- style flags: 256
  153. -- line height: 12
  154. -- part name: R1
  155.  
  156.  
  157. -- part 4 (field)
  158. -- low flags: 80
  159. -- high flags: 0000
  160. -- rect: left=189 top=74 right=87 bottom=233
  161. -- title width / last selected line: 0
  162. -- icon id / first selected line: 0 / 0
  163. -- text alignment: 65535
  164. -- font id: 3
  165. -- text size: 9
  166. -- style flags: 256
  167. -- line height: 12
  168. -- part name: R3
  169.  
  170.  
  171. -- part 5 (field)
  172. -- low flags: 00
  173. -- high flags: 0000
  174. -- rect: left=43 top=171 right=183 bottom=86
  175. -- title width / last selected line: 0
  176. -- icon id / first selected line: 0 / 0
  177. -- text alignment: 65535
  178. -- font id: 3
  179. -- text size: 9
  180. -- style flags: 256
  181. -- line height: 12
  182. -- part name: R2
  183.  
  184.  
  185. -- part 6 (field)
  186. -- low flags: 00
  187. -- high flags: 0000
  188. -- rect: left=188 top=170 right=182 bottom=232
  189. -- title width / last selected line: 0
  190. -- icon id / first selected line: 0 / 0
  191. -- text alignment: 65535
  192. -- font id: 3
  193. -- text size: 9
  194. -- style flags: 256
  195. -- line height: 12
  196. -- part name: R4
  197.  
  198.  
  199. -- part 7 (field)
  200. -- low flags: 01
  201. -- high flags: 0002
  202. -- rect: left=176 top=239 right=251 bottom=218
  203. -- title width / last selected line: 0
  204. -- icon id / first selected line: 0 / 0
  205. -- text alignment: 65535
  206. -- font id: 3
  207. -- text size: 9
  208. -- style flags: 256
  209. -- line height: 12
  210. -- part name: I
  211.  
  212.  
  213. -- part 8 (field)
  214. -- low flags: 00
  215. -- high flags: 0000
  216. -- rect: left=58 top=249 right=261 bottom=102
  217. -- title width / last selected line: 0
  218. -- icon id / first selected line: 0 / 0
  219. -- text alignment: 65535
  220. -- font id: 3
  221. -- text size: 9
  222. -- style flags: 256
  223. -- line height: 12
  224. -- part name: RV
  225.  
  226.  
  227. -- part 9 (field)
  228. -- low flags: 01
  229. -- high flags: 0002
  230. -- rect: left=152 top=118 right=131 bottom=202
  231. -- title width / last selected line: 0
  232. -- icon id / first selected line: 0 / 0
  233. -- text alignment: 65535
  234. -- font id: 3
  235. -- text size: 9
  236. -- style flags: 256
  237. -- line height: 12
  238. -- part name: I5
  239.  
  240.  
  241. -- part 10 (field)
  242. -- low flags: 00
  243. -- high flags: 0000
  244. -- rect: left=79 top=119 right=131 bottom=112
  245. -- title width / last selected line: 0
  246. -- icon id / first selected line: 0 / 0
  247. -- text alignment: 65535
  248. -- font id: 3
  249. -- text size: 9
  250. -- style flags: 256
  251. -- line height: 12
  252. -- part name: R5
  253.  
  254.  
  255. -- part 11 (field)
  256. -- low flags: 00
  257. -- high flags: 0000
  258. -- rect: left=112 top=264 right=276 bottom=144
  259. -- title width / last selected line: 0
  260. -- icon id / first selected line: 0 / 0
  261. -- text alignment: 65535
  262. -- font id: 3
  263. -- text size: 9
  264. -- style flags: 256
  265. -- line height: 12
  266. -- part name: EMF
  267.  
  268.  
  269. -- part 12 (button)
  270. -- low flags: 00
  271. -- high flags: 2003
  272. -- rect: left=259 top=167 right=185 bottom=275
  273. -- title width / last selected line: 0
  274. -- icon id / first selected line: 0 / 0
  275. -- text alignment: 1
  276. -- font id: 0
  277. -- text size: 12
  278. -- style flags: 0
  279. -- line height: 16
  280. -- part name: New Button
  281. ----- HyperTalk script -----
  282. on mouseDown
  283.   set hilite of card button "off" to false
  284.   set hilite of card button "on" to true
  285.   calculate
  286. end mouseDown
  287.  
  288. on mouseUp
  289.   set hilite of card button "on" to false
  290.   set hilite of card button "off" to true
  291.   put "" into card field "I5"
  292.   put "" into card field "I"
  293. end mouseUp
  294.  
  295.  
  296.  
  297.  
  298. -- part 13 (button)
  299. -- low flags: 00
  300. -- high flags: 8003
  301. -- rect: left=179 top=47 right=69 bottom=279
  302. -- title width / last selected line: 0
  303. -- icon id / first selected line: 0 / 0
  304. -- text alignment: 1
  305. -- font id: 0
  306. -- text size: 12
  307. -- style flags: 0
  308. -- line height: 16
  309. -- part name: Randomize
  310. ----- HyperTalk script -----
  311. on mouseUp
  312.   put (the random of 1000)/10 into card field "R3"
  313. end mouseUp
  314.  
  315.  
  316.  
  317. -- part 14 (button)
  318. -- low flags: 00
  319. -- high flags: 8003
  320. -- rect: left=207 top=93 right=113 bottom=275
  321. -- title width / last selected line: 0
  322. -- icon id / first selected line: 0 / 0
  323. -- text alignment: 1
  324. -- font id: 0
  325. -- text size: 12
  326. -- style flags: 0
  327. -- line height: 16
  328. -- part name: Show Rx
  329. ----- HyperTalk script -----
  330. on mouseDown
  331.   set visible of card field "R3" to true
  332. end mouseDown
  333.  
  334. on mouseUp
  335.   set visible of card field "R3" to false
  336. end mouseUp
  337.  
  338.  
  339.  
  340. -- part 17 (button)
  341. -- low flags: 00
  342. -- high flags: 8000
  343. -- rect: left=276 top=158 right=175 bottom=304
  344. -- title width / last selected line: 0
  345. -- icon id / first selected line: 0 / 0
  346. -- text alignment: 1
  347. -- font id: 0
  348. -- text size: 12
  349. -- style flags: 0
  350. -- line height: 16
  351. -- part name: On
  352.  
  353.  
  354. -- part 18 (button)
  355. -- low flags: 00
  356. -- high flags: C000
  357. -- rect: left=276 top=176 right=193 bottom=304
  358. -- title width / last selected line: 0
  359. -- icon id / first selected line: 0 / 0
  360. -- text alignment: 1
  361. -- font id: 0
  362. -- text size: 12
  363. -- style flags: 0
  364. -- line height: 16
  365. -- part name: Off
  366.  
  367.  
  368. -- part contents for background part 8
  369. ----- text -----
  370. C6. Wheatstone Bridge
  371.  
  372. -- part contents for card part 4
  373. ----- text -----
  374. 72.8
  375.  
  376. -- part contents for card part 6
  377. ----- text -----
  378. 100
  379.  
  380. -- part contents for card part 3
  381. ----- text -----
  382. 39.5
  383.  
  384. -- part contents for card part 5
  385. ----- text -----
  386. 50
  387.  
  388. -- part contents for card part 8
  389. ----- text -----
  390. 200
  391.  
  392. -- part contents for card part 10
  393. ----- text -----
  394. 100
  395.  
  396. -- part contents for card part 11
  397. ----- text -----
  398. 50